﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;

// For more information on enabling Web API for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860

namespace Sino.CapacityCloud.Web
{
    public class CredentialsResponse
    {
        public string Error { get; set; }
        public CredentialResponse Response { get; set; }
    }
    public class CredentialResponse
    {
        public string ExtData { get; set; }
        public int Total { get; set; }
        public IEnumerable<Credential> List { get; set; }
    }
    public class Credential
    {
        public string Id { get; set; }
        public string AppKey { get; set; }
        public string AppSecrect { get; set; }

    }
    public class CredentialsController : Controller
    {
        [HttpGet("credentials")]
        public IActionResult credentials(int startIndex = 0, int count = 10)
        {
            var response = new CredentialsResponse()
            {
                Error = null,
                Response = new CredentialResponse()
                {
                    ExtData = null,
                    Total = 10,
                    List = new List<Credential>() { new Credential() { Id = Guid.NewGuid().ToString(), AppKey = "kj7swf8o7rls2", AppSecrect = "wGIRXpOChWGG" } }

                }
            };
            return Json(response, new Newtonsoft.Json.JsonSerializerSettings() { ContractResolver = new DefaultContractResolver() });

        }
    }
}
